package cn.maxwell.feignclient;

import cn.maxwell.enums.GlobalErrorCode;
import cn.maxwell.result.JsonResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class MovieFallback implements FallbackFactory<MoveFeiGinClient> {

    @Override
    public MoveFeiGinClient create(Throwable throwable) {
        return new MoveFeiGinClient() {
            @Override
            public JsonResult get(Long id) {
                return JsonResult.error(GlobalErrorCode.MOVIE_ERROR);
            }

            @Override
            public JsonResult list() {
                return JsonResult.error(GlobalErrorCode.MOVIE_ERROR);
            }

            @Override
            public JsonResult byMovieTicket(Long id, Long userId, Integer count) {
                return JsonResult.error(GlobalErrorCode.MOVIE_ERROR);
            }

            @Override
            public JsonResult seeMovie(Long id, Long userId) {
                return JsonResult.error(GlobalErrorCode.MOVIE_ERROR);
            }
        };
    }
}
